package com.atgion.service.fallback;

import com.atgion.service.UserFeignClient;
import com.atgion.spzx.model.entity.user.UserAddress;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;


@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable cause) {

        return new UserFeignClient() {
            @Override
            public UserAddress getUserAddress(Long id) {
                UserAddress userAddress = new UserAddress();
                userAddress.setId(1L);
                log.error("查询用户异常", cause);
                return userAddress;
            }
        };
    }
}
